@extends('admin.master')

    @section('css-header')
        @parent
        {{ HTML::style('assets/admin/css/bootstrap-wysihtml5.css') }}
        {{ HTML::style('assets/admin/css/bootstrap-multiselect.css') }}
        {{ HTML::style('assets/admin/css/prettify.css') }}
    @stop

    @section('content')
    <h1>Editar <small>{{ $relato->titulo }}</small></h1>

            <!-- if there are creation errors, they will show here -->
            @if($errors->has())
            <div class="alert alert-danger">{{ HTML::ul($errors->all()) }}</div>
            @endif
            
            {{-- Note that we have to pass a method of PUT so that Laravel knows
                 how to route to the controller correctly. --}}
            {{ Form::model($relato, array('route' => array('admin.relatos.update', $relato->id), 'method' => 'PUT', 'files' => true)) }}
            

                    <div class="row">
                        <div class="col-lg-6">
                            <div class="form-group">
                                {{ Form::label('titulo', 'Titulo') }}
                                {{ Form::text('titulo', null, array('class' => 'form-control')) }}
                            </div>
                            <div class="form-group">
                                {{ Form::label('objetos', 'Objetos') }}
                                {{ Form::select('objetos[]', $objetos, $relato->objetos->lists('id'), ['class' => 'multiselect', 'multiple']) }}
                            </div>
                        </div>
                        <div class="col-lg-2">
                            <div class="form-group">
                                {{ Form::label('tags', 'Categoría') }}
                                {{ Form::select('tags', $tags, $relato->tags->first()->id, ['class' => 'form-control'] ) }}
                                {{-- Form::select('tags[]', TagRel::lists('nombre', 'id'), $relato->tags->lists('id'), array('class' => 'form-control', 'multiple')) --}}
                            </div>
                        </div>
                        <div class="col-lg-2">
                            <div class="form-group">
                                {{ Form::label('estado', 'Estado') }}<br>
                                {{-- Form::checkbox(name, value, checked) --}}
                                {{ Form::radio('estado', 1, null) }} Publico
                                {{ Form::radio('estado', 0, null) }} Privado
                            </div>
                        </div>
                        <div class="col-lg-2">
                            {{ Form::label('publicar', 'Publicar') }}<br>
                            <div>
                            {{ Form::button('<span class="ladda-label">Editar</span>', ['type' => 'submit', 'class' => 'ladda-button btn btn-primary', 'data-style'=>'zoom-in']) }}
                            {{ HTML::link('admin/relatos', 'Cancelar', ['class' => 'btn btn-default']) }}
                            </div>
                        </div>
                    </div>
            
                    <div class="row">
                        <div class="col-lg-8">
                            <div class="form-group">
                                {{ Form::label('texto', 'Texto') }}
                                {{ Form::textarea('texto', null, array('class' => 'form-control', 'id' => 'wysiwyg-textarea')) }}
                            </div>
                            <div class="form-group">
                                {{ Form::label('bajada', 'Bajada') }}
                                {{ Form::textarea('bajada', null, array('class' => 'form-control')) }}
                            </div>
                        </div>
                        <div class="col-lg-4">
                            {{ Form::label('image', 'Agregar im&aacute;genes (jpeg)') }}
                            <div class="form-group panel panel-default">
                                <div class="panel-body">
                                    @include('admin.imagenes.uploadImagen')
                                </div>
                            </div>
                            {{ Form::close() }}
                        </div>
                    </div>
        @if(count($images))
        @include('admin.imagenes.viewImagen')
        @endif
    @stop
@section('js-footer')
    @parent
    {{ HTML::script('assets/admin/js/wysihtml5-0.3.0.min.js') }}
    {{ HTML::script('assets/admin/js/bootstrap3-wysihtml5.js') }}
    {{ HTML::script('assets/admin/js/jquery.preimage.js') }}
    {{ HTML::script('assets/admin/js/bootstrap-multiselect.js') }}
    {{ HTML::script('assets/admin/js/prettify.js') }}
    {{ HTML::script('assets/admin/js/scripts.js') }}


    <script type="text/javascript">
        {{-- IMAGENES ORDENABLES --}}
        $( ordenarItems("#sort", "{{ URL::to('admin/' .$entidad .  '/imagenes/ordenar') }}", '') );
    </script>
@stop